package com.itheima.user;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient //声明为注册中心 客户端 (同样适用nacos)
//@EnableEurekaClient 只适用于Eureka注册中心
@EnableFeignClients //声明开启feign调用 (谁发起调用 给谁用)
public class UserApplication {

    public static void main(String[] args) {
        SpringApplication.run(UserApplication.class,args);
    }

    //RestTemplate注入
    @Bean
    @LoadBalanced // 开启ribbon负载均衡调用
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
